<admintpl file="headerEx"/>
<link href="__PUBLIC__/js/artDialog/skins/default.css" rel="stylesheet" />
<title>{:L('ADMIN_STORAGE_INDEX')}</title>
<!--responsive table-->
<link href="__PUBLIC__/TciocEx/css/table-responsive.css" rel="stylesheet"/>
<!--ios7-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/TciocEx/js/ios-switch/switchery.css" />

<!--icheck-->
<link href="__PUBLIC__/TciocEx/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
<link href="__PUBLIC__/TciocEx/js/iCheck/skins/minimal/red.css" rel="stylesheet">
<link href="__PUBLIC__/TciocEx/js/iCheck/skins/minimal/green.css" rel="stylesheet">
</head>
<body class="sticky-header">
<section>
	<!-- main content start-->
	<div class="full-content">
		<!-- body wrapper start -->
		<div class="wrapper">
			<div class="row">
				<div class="col-sm-12">
					<section class="panel">
						<header class="panel-heading custom-tab turquoise-tab">
							<ul class="nav nav-tabs">
								<li class="active"><a href="{:U('storage/index')}"><i class="fa fa-list-ul"></i>{:L('ADMIN_STORAGE_INDEX')}</a></li>
							</ul>
						</header>
						<div class="panel-body">
							<div class=" form">
								<form class="cmxform form-horizontal adminex-form js-ajax-form" id="commentForm" method="post" action="{:U('storage/setting_post')}"      novalidate="novalidate" enctype="multipart/form-data">
									<div class="form-group">
										<div class="col-lg-10">
											<php>$support_storages=array("Local"=>L('DEFAULT'),"Qiniu"=>L('QINIU'));</php>
											&nbsp;<select class=" input-lg "  name="type" id="type" style="padding: 5px 16px;height: auto">
												<foreach name="support_storages" item="vo">
													<php>$type_selected=$type==$key?"selected":"";</php>
													<option value="{$key}"{$type_selected}>{$vo}</option>
												</foreach>
											</select>
										</div>
									</div>
									<div class="panel-heading custom-tab turquoise-tab">
										<ul class="nav nav-tabs">
											<li class="active"><a href="#qiniu-setting" data-toggle="tab">{:L('QINIU')}</a></li>
											<li><a href="#qiniu-picture-protect" data-toggle="tab">原图保护设置</a></li>
										</ul>
									</div>

									<fieldset>
										<div class="tabbable">
											<div class="tab-content">
												<br>
													<div class="tab-pane active" id="qiniu-setting">
														<div class="form-group">
															<label for="accessKey" class="control-label col-lg-2" >AccessKey</label>
															<div class="col-lg-10">
																<input   class=" form-control" id="accessKey" type="text" name="Qiniu[accessKey]" value="{$Qiniu.accessKey}">
															</div>
														</div>
														<div class="form-group">
															<label for="secretKey" class="control-label col-lg-2">SecretKey</label>
															<div class="col-lg-10">
																<input   class=" form-control" id="secretKey" type="text" name="Qiniu[secretKey]" value="{$Qiniu.secretKey}">
															</div>
														</div>
														<div class="form-group">
															<label for="upHost" class="control-label col-lg-2">上传域名</label>
															<div class="col-lg-10">
																<input   class=" form-control" id="upHost"   type="text" name="Qiniu[upHost]" value="{$Qiniu.upHost}">
								<span class="help-block">
									七牛不同存储区域上传域名不一样，根据您空间的存储区域,设置不同的域名；<br>
									华东：http://up.qiniu.com,华北：http://up-z1.qiniu.com;<br>
									默认为华东；
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="protocol" class="control-label col-lg-2">域名协议</label>
															<div class="col-lg-10">
																&nbsp;<select name="Qiniu[setting][protocol]"  class=" input-lg "  id="protocol" style="padding: 5px 16px;height: auto">
																	<option value="http">http</option>
																	<eq name="Qiniu.setting.protocol" value="https">
																		<option value="https" selected="selected">https</option>
																		<else />
																		<option value="https">https</option>
																	</eq>

																</select>
															</div>
														</div>
														<div class="form-group">
															<label for="domain" class="control-label col-lg-2">{:L('DOMAIN')}</label>
															<div class="col-lg-10">
																<input   class=" form-control" id="domain" type="text" name="Qiniu[domain]" value="{$Qiniu.domain}">
															</div>
														</div>
														<div class="form-group">
															<label for="bucket" class="control-label col-lg-2">{:L('BUCKET')}</label>
															<div class="col-lg-10">
																<input   class=" form-control" id="bucket" type="text" name="Qiniu[bucket]" value="{$Qiniu.bucket}">
															</div>
														</div>
														<div class="form-group">
															<label  class="control-label col-lg-2">{:L('GET_ACCESS_KEY')}</label>
															<div class="col-lg-10">
																<a href="https://portal.qiniu.com/signup?code=3lfihpz361o42" target="_blank">{:L('GET_IT_NOW')}</a>
															</div>
														</div>
														<div class="form-group">
															<label  class="control-label col-lg-2">{:L('QINIU_PROMOTION_CODE')}</label>
															<div class="col-lg-10">
																<a href="http://www.thinkcmf.com/topic/topic/index/id/103.html" target="_blank">507670e8</a>
																<a href="https://portal.qiniu.com/signin" target="_blank">立即充值</a>
															</div>
														</div>
														<div class="form-group">
															<label  class="control-label col-lg-2">七牛帮助文档</label>
															<div class="col-lg-10">
																<a href="http://www.thinkcmf.com/qiniu/help.html" target="_blank">立即访问</a>
															</div>
														</div>
													</div>
													<div class="tab-pane" id="qiniu-picture-protect">
														<div class="form-group">
															<label for="enable_picture_protect" class="control-label col-lg-2">开启原图保护</label>
															<div class="col-lg-10">
																<select name="Qiniu[setting][enable_picture_protect]" class=" input-lg "  id="enable_picture_protect" style="padding: 5px 16px;height: auto">
																	<option value="0">关闭</option>
																	<empty name="Qiniu.setting.enable_picture_protect">
																		<option value="1">开启</option>
																		<else />
																		<option value="1" selected="selected">开启</option>
																	</empty>

																</select>
															</div>
														</div>

														<div class="form-group">
															<label for="style_separator" class="control-label col-lg-2">样式分隔符</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="style_separator" type="text" name="Qiniu[setting][style_separator]" value="{$Qiniu.setting.style_separator|default='!'}">
															</div>
														</div>
														<div class="form-group">
															<label for="watermark" class="control-label col-lg-2">样式-水印</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="watermark" type="text" name="Qiniu[setting][styles][watermark]" value="{$Qiniu.setting.styles.watermark|default='watermark'}">
								<span class="help-block">
									请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="avatar" class="control-label col-lg-2">样式-头像</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="avatar" type="text" name="Qiniu[setting][styles][avatar]" value="{$Qiniu.setting.styles.watermark|default='avatar'}">
								<span class="help-block">
									请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置
									处理接口:<br>
									imageView2/1/w/100/h/100/interlace/0/q/100
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="thumbnail120x120" class="control-label col-lg-2">样式-缩略图120x120</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="thumbnail120x120" type="text" name="Qiniu[setting][styles][thumbnail120x120]" value="{$Qiniu.setting.styles.thumbnail120x120|default='thumbnail120x120'}">
								<span class="help-block">
								请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置<br>
								处理接口:<br>
								imageView2/1/w/120/h/120/interlace/0/q/100
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="thumbnail300x300" class="control-label col-lg-2">样式-缩略图300x300</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="thumbnail300x300" type="text" name="Qiniu[setting][styles][thumbnail300x300]" value="{$Qiniu.setting.styles.thumbnail300x300|default='thumbnail300x300'}">
								<span class="help-block">
								请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置<br>
								处理接口:<br>
								imageView2/1/w/300/h/300/interlace/0/q/100
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="thumbnail640x640" class="control-label col-lg-2">样式-缩略图640x640</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="thumbnail640x640" type="text" name="Qiniu[setting][styles][thumbnail640x640]" value="{$Qiniu.setting.styles.thumbnail640x640|default='thumbnail640x640'}">
								<span class="help-block">
								请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置<br>
								处理接口:<br>
								imageView2/1/w/640/h/640/interlace/0/q/100
								</span>
															</div>
														</div>
														<div class="form-group">
															<label for="thumbnail1080x1080" class="control-label col-lg-2">样式-缩略图1080x1080</label>
															<div class="col-lg-10">
																<input   class=" form-control"  id="thumbnail1080x1080" type="text" name="Qiniu[setting][styles][thumbnail1080x1080]" value="{$Qiniu.setting.styles.thumbnail1080x1080|default='thumbnail1080x1080'}">
								<span class="help-block">
								请到七牛存储空间->图片样式：添加此样式名称，并进行相应设置<br>
								处理接口:<br>
								imageView2/1/w/1080/h/1080/interlace/0/q/100
								</span>
															</div>
														</div>
													</div>
												</div>
										</div>
										<div class="form-group">
											<div class="col-md-12 text-center clearfix" style="width: auto; padding-left: 25%;padding-top: 20px;">
												<button class="btn btn-primary js-ajax-submit" type="submit">{:L('SAVE')}</button>
												<a href="javascript:history.back(-1);" class="btn btn-default">{:L('BACK')}</a>
											</div>
										</div>
									</fieldset>
								</form>
							</div>

						</div>
					</section>

				</div>
			</div>
		</div>
		<!--footer section start-->
		<footer>
			<admintpl file="copyright"/>
		</footer>
		<!--footer section end-->
	</div>
	<!-- main content end-->
</section>
<script src="__PUBLIC__/TciocEx/js/jquery-1.10.2.min.js"></script>
<script src="__PUBLIC__/js/wind.js"></script>
<script src="__PUBLIC__/js/common.js"></script>
<script src="__PUBLIC__/TciocEx/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="__PUBLIC__/simpleboot/bootstrap/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/jquery-migrate-1.2.1.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/bootstrap.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/modernizr.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/jquery.nicescroll.js"></script>
<script src="__PUBLIC__/js/ajaxForm.js"></script>

<script type="text/javascript" src="__PUBLIC__/TciocEx/js/jquery.validate.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/validation-localization/messages_zh.min.js"></script>
<script src="__PUBLIC__/TciocEx/js/scripts.js"></script>
<script src="__PUBLIC__/TciocEx/js/validation-init.js"></script>
<script>
	/////---------------------
	$(function(){
		$("#urlmode-select").change(function(){
			if($(this).val()==1){
				alert("更改后，若发现前台链接不能正常访问，可能是您的服务器不支持PATHINFO，请先修改data/conf/config.php文件的URL_MODEL为0保证网站正常运行,在配置服务器PATHINFO功能后再更新为PATHINFO模式！");
			}

			if($(this).val()==2){
				alert("更改后，若发现前台链接不能正常访问，可能是您的服务器不支持REWRITE，请先修改data/conf/config.php文件的URL_MODEL为0保证网站正常运行，在开启服务器REWRITE功能后再更新为REWRITE模式！");
			}
		});
		$("#js-site-admin-url-password").change(function(){
			$(this).data("changed",true);
		});
	});
	Wind.use('validate', 'ajaxForm', 'artDialog', function() {
		//javascript
		var form = $('form.js-ajax-forms');
		//ie处理placeholder提交问题
		if ($.browser && $.browser.msie) {
			form.find('[placeholder]').each(function() {
				var input = $(this);
				if (input.val() == input.attr('placeholder')) {
					input.val('');
				}
			});
		}
		//表单验证开始
		form.validate({
			//是否在获取焦点时验证
			onfocusout : false,
			//是否在敲击键盘时验证
			onkeyup : false,
			//当鼠标掉级时验证
			onclick : false,
			//验证错误
			showErrors : function(errorMap, errorArr) {
				//errorMap {'name':'错误信息'}
				//errorArr [{'message':'错误信息',element:({})}]
				try {
					$(errorArr[0].element).focus();
					art.dialog({
						id : 'error',
						icon : 'error',
						lock : true,
						fixed : true,
						background : "#CCCCCC",
						opacity : 0,
						content : errorArr[0].message,
						cancelVal : "{:L('OK')}",
						cancel : function() {
							$(errorArr[0].element).focus();
						}
					});
				} catch (err) {
				}
			},
			//验证规则
			rules : {
				'options[site_name]' : {
					required : 1
				},
				'options[site_host]' : {
					required : 1
				},
				'options[site_root]' : {
					required : 1
				}
			},
			//验证未通过提示消息
			messages : {
				'options[site_name]' : {
					required : "{:L('WEBSITE_SITE_NAME_REQUIRED_MESSAGE')}"
				},
				'options[site_host]' : {
					required : "{:L('WEBSITE_SITE_HOST_REQUIRED_MESSAGE')}"
				}
			},
			//给未通过验证的元素加效果,闪烁等
			highlight : false,
			//是否在获取焦点时验证
			onfocusout : false,
			//验证通过，提交表单
			submitHandler : function(forms) {
				$(forms).ajaxSubmit({
					url : form.attr('action'), //按钮上是否自定义提交地址(多按钮情况)
					dataType : 'json',
					beforeSubmit : function(arr, $form, options) {

					},
					success : function(data, statusText, xhr, $form) {
						if (data.status) {
							setCookie("refersh_time", 1);
							var admin_url_changed=$("#js-site-admin-url-password").data("changed");
							var message =admin_url_changed?data.info+'<br><span style="color:red;">后台地址已更新(请劳记！)</span>':data.info;

							//添加成功
							Wind.use("artDialog", function() {
								art.dialog({
									id : "succeed",
									icon : "succeed",
									fixed : true,
									lock : true,
									background : "#CCCCCC",
									opacity : 0,
									content : message,
									button : [ {
										name : "{:L('OK')}",
										callback : function() {
											reloadPage(window);
											return true;
										},
										focus : true
									}, {
										name : "{:L('CLOSE')}",
										callback : function() {
											reloadPage(window);
											return true;
										}
									} ]
								});
							});
						} else {
							alert(data.info);
						}
					}
				});
			}
		});
	});
	////-------------------------
</script>
</body>
</html>
